package com.EAIPClub.ResourcesInfoManager.mapper;

import com.api.POJO.ResourcesInfoManager.ResourcesInfoManagerUserFileInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description :静态资源信息管理模块用户资源信息Mapper
 * @Author :崔昌赫
 * @Date : 2021/11/2
 */
@Repository
@Mapper
public interface ResourcesInfoManagerFileUserInfoMapper {
    @Insert("INSERT INTO res_user_info VALUES ('${fileInfo.fuid}','${fileInfo.uuid}')")
    Boolean addNewFileUserInfo(@Param("fileInfo") ResourcesInfoManagerUserFileInfo fileInfo);

    @Select("SELECT * FROM res_user_info WHERE 1=1")
    List<ResourcesInfoManagerUserFileInfo> findAllFileUserInfo();

    @Select("SELECT * FROM res_user_info WHERE fuid = '${fuid}'")
    ResourcesInfoManagerUserFileInfo findFileUserInfoByFuid(@Param("fuid")String fuid);
    @Select("SELECT * FROM res_user_info WHERE uuid = '${uuid}'")
    ResourcesInfoManagerUserFileInfo findFileUserInfoByUuid(@Param("uuid")String uuid);

    @Update("UPDATE res_user_info SET fuid='${fileInfo.fuid}',uuid='${fileInfo.uuid}' WHERE fuid='${fuid}'")
    Boolean updateFileUserInfoByFuid(@Param("fuid")String fuid,@Param("fileInfo")ResourcesInfoManagerUserFileInfo fileInfo);
    @Update("UPDATE res_user_info SET fuid='${fileInfo.fuid}',uuid='${fileInfo.uuid}' WHERE uuid='${uuid}'")
    Boolean updateFileUserInfoByUuid(@Param("uuid")String uid,@Param("fileInfo")ResourcesInfoManagerUserFileInfo fileInfo);

    @Delete("DELETE FROM res_user_info WHERE fuid='${fuid}'")
    Boolean deleteFileUserInfoByFuid(@Param("fuid")String fuid);
    @Delete("DELETE FROM res_user_info WHERE uuid='${uuid}'")
    Boolean deleteFileUserInfoByUuid(@Param("uuid")String uuid);
}
